﻿using System;
using System.Reflection;

namespace Phoenix.Xna.Framework
{
    public abstract class Service : EngineComponent, IService
    {
        public Service()
            : base()
        {
            //Type[] interfaces = this.GetType().GetInterfaces();
            //Engine.Instance.Services.AddService(interfaces[interfaces.Length - 1], this);
        }

        public Service(string id)
            : base(id)
        {
            //Type[] interfaces = this.GetType().GetInterfaces();
            //Engine.Instance.Services.AddService(interfaces[interfaces.Length - 1], this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                }

                IsDisposed = true;
            }
        }

        #region IDisposableEx Members

        public bool IsDisposed { get; set; }

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }
}
